package com.springboot.es.elasticsearch.controller;

import com.springboot.es.elasticsearch.dao.GoodRepostory;
import com.springboot.es.elasticsearch.entity.GoodsInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class GoodsController {
    @Autowired
    private GoodRepostory repostory;


    /**
     *  @Date： 2019/1/7
     *  @Desc: 保存
     *  @Author: wushihao
     */
    @GetMapping(value = "save")
    public String save(){
        GoodsInfo info = new GoodsInfo("2", "车",909999L);
        repostory.save(info);
        return "success";
    }



    @GetMapping(value = "delete")
    public String delete(){
        GoodsInfo info = new GoodsInfo();
        info.setId("2");
        repostory.delete(info);
        return "success";
    }

    @GetMapping(value = "get")
    public Object getOne(){
        Object o = repostory.findById("1");
        return o;
    }




}
